using System.Xml;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Exoa.Cameras.Demos;
public class BuildBiaoQian : BiaoQianCreat
{
    GameObject animator;
    GameObject ZuDang;
    public override void OnCreat()
    {
        标签.GetComponentInChildren<TextMeshProUGUI>().text = gameObject.name;
        animator = GameObject.Find("建筑弹窗");
        if (animator == null)
            Debug.LogError("标签名称为建筑弹窗的物体不存在");
        ZuDang = GameObject.Find("阻挡");

        if (ZuDang == null)
            Debug.LogError("标签名称为阻挡的物体不存在");

        if (animator != null)
            animator.GetComponentInChildren<Button>().onClick.AddListener(() =>
            {
                animator.GetComponent<Animator>().SetBool("isOn", false);
                ZuDang.GetComponent<Image>().raycastTarget = false;
            });
    }
    public override void OnClickFunc()
    {
        if (ZuDang == null|| animator == null)
            return;

        animator.GetComponentInChildren<TextMeshProUGUI>().text = gameObject.name;
        animator.GetComponent<Animator>().SetBool("isOn", true);
        ZuDang.GetComponent<Image>().raycastTarget = true;
    }
}
